
<!DOCTYPE html>
<html lang="zh-cn">

<style>
    tr.change:hover {
        background-color: #00FF00
    }
</style>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <title>银行卡号生成器</title>
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
    <style>

        .bankTr {
            background-color: #003bb3;
            color: #fff;
        }
    </style>
</head>

<body style="background-color: #f6f6f6">

<div class="container">
    <div style="background-color: white; text-align: center">
        <h2 style="background-color: #dff0d8">银行卡号生成器</h2>
        <div style="display: table-cell;" >
            <span style="background-color: #a9dba9">请选择(一级)</span>
            <table id="banck" class="table" style="text-align: left; width: 150px;border: solid 2px;">
                <tr>
                    <td>邮储银行</td>
                </tr>
                <tr>
                    <td>工商银行</td>
                </tr>
                <tr>
                    <td>中国银行</td>
                </tr>
                <tr>
                    <td>建设银行</td>
                </tr>
                <tr>
                    <td>交通银行</td>
                </tr>
                <tr>
                    <td>光大银行</td>
                </tr>
                <tr>
                    <td>民生银行</td>
                </tr>
                <tr class="bankTr">
                    <td>招商银行</td>
                </tr>
                <tr>
                    <td>兴业银行</td>
                </tr>
                <tr>
                    <td>浦发银行</td>
                </tr>
                <tr>
                    <td>平安银行</td>
                </tr>
                <tr>
                    <td>农业银行</td>
                </tr>
            </table>
        </div>
        <span style="display: table-cell; width: 50px; font-size: 18px">
            <br/><br/><br/><br/>
            <B>----></B>
        </span>
        <div style="display: table-cell;">
            <span style="background-color: #a9dba9">请选择(二级)</span>
            <table id="subbanck" class="table" style="text-align: left; width: 250px;border: solid 2px;">
                <tr class="bankTr">
                    <td>招商银行(一卡通(借记卡))</td>
                </tr>
                <tr>
                    <td>招商银行(金葵花卡(借记卡))</td>
                </tr>
                <tr>
                    <td>招商银行(金卡(借记卡))</td>
                </tr>
                <tr>
                    <td>招商银行(万事达信用卡)</td>
                </tr>
                <tr>
                    <td>招商银行(信用卡)</td>
                </tr>
                <tr>
                    <td>招商银行(万事达信用卡)</td>
                </tr>
            </table>
        </div>
        <span style="display: table-cell; width: 150px; font-size: 18px">
            <br/><br/><br/><br/>
            <button class="btn btn-primary" id="bankCardGen">生成银行卡号</button>
        </span>
        <div style="display: table-cell;" >
            <span style="background-color: #a9dba9">银行卡号列表</span>
            <table id="cardNoList" class="table" style="text-align: left; width: 350px;border: solid 2px;">
            </table>
        </div>
    </div>
</div>

<script>
    var map = {};
    var   yzbank = ['邮储银行(绿卡VIP卡(借记卡))','邮储银行(标准卡(借记卡))','邮储银行(教育卡(借记卡))','邮储银行(福农卡(借记卡))','邮储银行(绿卡通(借记卡))'];
    var bankMap={};
    bankMap['邮储银行(绿卡VIP卡(借记卡))'] = {'cn':'19','bin':'621095'};
    bankMap['邮储银行(标准卡(借记卡))'] = {'cn':'19','bin':'620062'};
    bankMap['邮储银行(教育卡(借记卡))'] = {'cn':'19','bin':'622189'};
    bankMap['邮储银行(福农卡(借记卡))'] = {'cn':'19','bin':'621582'};
    bankMap['邮储银行(绿卡通(借记卡))'] = {'cn':'19','bin':'621096'};
    var   gsbank = ['工商银行(牡丹灵通卡(借记卡))','工商银行(银联金卡(贷记卡))','工商银行(银联白金卡(贷记卡))','工商银行(银联普卡(贷记卡))','工商银行(银联标准卡(借记卡))'];
    bankMap['工商银行(牡丹灵通卡(借记卡))'] = {'cn':'18','bin':'620200'};
    bankMap['工商银行(银联金卡(贷记卡))'] = {'cn':'16','bin':'622911'};
    bankMap['工商银行(银联白金卡(贷记卡))'] = {'cn':'16','bin':'622912'};
    bankMap['工商银行(银联普卡(贷记卡))'] = {'cn':'16','bin':'622913'};
    bankMap['工商银行(银联标准卡(借记卡))'] = {'cn':'19','bin':'620058'};
    var   zgbank = ['中国银行(联名卡(借记卡))','中国银行(理财金卡(借记卡))','中国银行(个人普卡(贷记卡))','中国银行(员工普卡(借记卡))','中国银行(理财普卡(借记卡))'];
    bankMap['中国银行(联名卡(借记卡))'] = {'cn':'19','bin':'621660'};
    bankMap['中国银行(理财金卡(借记卡))'] = {'cn':'19','bin':'621668'};
    bankMap['中国银行(个人普卡(贷记卡))'] = {'cn':'16','bin':'409666'};
    bankMap['中国银行(员工普卡(借记卡))'] = {'cn':'19','bin':'621663'};
    bankMap['中国银行(理财普卡(借记卡))'] = {'cn':'19','bin':'621667'};
    var   jsbank = ['建设银行(龙卡储蓄卡(借记卡))','建设银行(金融IC卡(借记卡))','建设银行(理财金卡(借记卡))','建设银行(福农卡(借记卡))','建设银行(龙卡通(借记卡))'];
    bankMap['建设银行(龙卡储蓄卡(借记卡))'] = {'cn':'19','bin':'436742'};
    bankMap['建设银行(金融IC卡(借记卡))'] = {'cn':'19','bin':'621081'};
    bankMap['建设银行(理财金卡(借记卡))'] = {'cn':'16','bin':'622988'};
    bankMap['建设银行(福农卡(借记卡))'] = {'cn':'19','bin':'621598'};
    bankMap['建设银行(龙卡通(借记卡))'] = {'cn':'19','bin':'621700'};
    var   jtbank = ['交通银行(交行预付卡(预付费卡))','交通银行(太平洋借记卡)','交通银行(太平洋互连卡(借记卡))','交通银行(太平洋信用卡)','交通银行(白金卡(贷记卡))'];
    bankMap['交通银行(交行预付卡(预付费卡))'] = {'cn':'19','bin':'620021'};
    bankMap['交通银行(太平洋借记卡)'] = {'cn':'17','bin':'622258'};
    bankMap['交通银行(太平洋互连卡(借记卡))'] = {'cn':'17','bin':'66405512'};
    bankMap['交通银行(太平洋信用卡)'] = {'cn':'16','bin':'6649104'};
    bankMap['交通银行(白金卡(贷记卡))'] = {'cn':'16','bin':'622656'};
    var   gdbank = ['光大银行(阳光卡(借记卡))','光大银行(借记卡普卡)','光大银行(阳光旅行卡(借记卡)','光大银行(联名IC卡钻石卡(借记卡))','光大银行(借记IC卡钻石卡)'];
    bankMap['光大银行(阳光卡(借记卡))'] = {'cn':'16','bin':'622663'};
    bankMap['光大银行(借记卡普卡)'] = {'cn':'16','bin':'620518'};
    bankMap['光大银行(阳光旅行卡(借记卡)'] = {'cn':'16','bin':'620085'};
    bankMap['光大银行(联名IC卡钻石卡(借记卡))'] = {'cn':'16','bin':'623159'};
    bankMap['光大银行(借记IC卡钻石卡)'] = {'cn':'16','bin':'623155'};
    var   msbank = ['民生银行(钻石卡(借记卡))','民生银行(借记卡)','民生银行(普卡(借记卡))','民生银行(理财卡(借记卡))','民生银行(国际卡(借记卡))'];
    bankMap['民生银行(钻石卡(借记卡))'] = {'cn':'16','bin':'622618'};
    bankMap['民生银行(借记卡)'] = {'cn':'16','bin':'623255'};
    bankMap['民生银行(普卡(借记卡))'] = {'cn':'16','bin':'621691'};
    bankMap['民生银行(理财卡(借记卡))'] = {'cn':'16','bin':'622620'};
    bankMap['民生银行(国际卡(借记卡))'] = {'cn':'16','bin':'472068'};
    var   zsbank = ['招商银行(一卡通(借记卡))','招商银行(金葵花卡(借记卡))','招商银行(金卡(借记卡))','招商银行(万事达信用卡)','招商银行(信用卡)'];
    bankMap['招商银行(一卡通(借记卡))'] = {'cn':'16','bin':'622580'};
    bankMap['招商银行(金葵花卡(借记卡))'] = {'cn':'16','bin':'621286'};
    bankMap['招商银行(金卡(借记卡))'] = {'cn':'16','bin':'622609'};
    bankMap['招商银行(万事达信用卡)'] = {'cn':'16','bin':'545619'};
    bankMap['招商银行(信用卡)'] = {'cn':'16','bin':'622575'};
    var   xybank = ['兴业银行(兴业卡(借记卡))','兴业银行(智能卡(借记卡))','兴业银行(管家卡(借记卡))','兴业银行(加菲猫信用卡)','兴业银行(信用卡)'];
    bankMap['兴业银行(兴业卡(借记卡))'] = {'cn':'16','bin':'90592'};
    bankMap['兴业银行(智能卡(借记卡))'] = {'cn':'18','bin':'438588'};
    bankMap['兴业银行(管家卡(借记卡))'] = {'cn':'17','bin':'623287'};
    bankMap['兴业银行(加菲猫信用卡)'] = {'cn':'16','bin':'527414'};
    bankMap['兴业银行(信用卡)'] = {'cn':'16','bin':'549633'};
    var   pfbank = ['浦发银行(东方卡(借记卡))','浦发银行(贷记卡)','浦发银行(公务卡金卡(贷记卡))','浦发银行(万事达金卡(贷记卡))','浦发银行(移动联名卡(借记卡))'];
    bankMap['浦发银行(东方卡(借记卡))'] = {'cn':'16','bin':'622521'};
    bankMap['浦发银行(贷记卡)'] = {'cn':'16','bin':'625957'};
    bankMap['浦发银行(公务卡金卡(贷记卡))'] = {'cn':'16','bin':'628222'};
    bankMap['浦发银行(万事达金卡(贷记卡))'] = {'cn':'16','bin':'517650'};
    bankMap['浦发银行(移动联名卡(借记卡))'] = {'cn':'16','bin':'621351'};
    var   pabank = ['平安银行(发展借记卡(借记卡))','平安银行(国际借记卡)','平安银行(公益预付卡)','平安银行(聚财卡金卡(借记卡))','平安银行(聚财卡钻石卡(借记卡))'];
    bankMap['平安银行(发展借记卡(借记卡))'] = {'cn':'16','bin':'998800'};
    bankMap['平安银行(国际借记卡)'] = {'cn':'16','bin':'415752'};
    bankMap['平安银行(公益预付卡)'] = {'cn':'16','bin':'620010'};
    bankMap['平安银行(聚财卡金卡(借记卡))'] = {'cn':'16','bin':'622535'};
    bankMap['平安银行(聚财卡钻石卡(借记卡))'] = {'cn':'16','bin':'622983'};
    var   nybank = ['农业银行(金穗贷记卡)','农业银行(中国旅游卡(借记卡))','农业银行(银联标准卡(借记卡))','农业银行(金穗通宝卡(借记卡))','农业银行(金穗信用卡)'];
    bankMap['农业银行(金穗贷记卡)'] = {'cn':'16','bin':'552599'};
    bankMap['农业银行(中国旅游卡(借记卡))'] = {'cn':'19','bin':'623206'};
    bankMap['农业银行(银联标准卡(借记卡))'] = {'cn':'19','bin':'620059'};
    bankMap['农业银行(金穗通宝卡(借记卡))'] = {'cn':'19','bin':'622844'};
    bankMap['农业银行(金穗信用卡)'] = {'cn':'16','bin':'6353591'};

    map['邮储银行'] =  yzbank;
    map['工商银行'] =  gsbank;
    map['中国银行'] =  zgbank;
    map['建设银行'] =  jsbank;
    map['交通银行'] =  jtbank;
    map['光大银行'] =  gdbank;
    map['民生银行'] =  msbank;
    map['招商银行'] =  zsbank;
    map['兴业银行'] =  xybank;
    map['浦发银行'] =  pfbank;
    map['平安银行'] =  pabank;
    map['农业银行'] =  nybank;
    $("#banck tr").click(function () {
        $("#banck tr").removeClass("bankTr");
        $(this).addClass("bankTr");
        var subBank = map[$(this).find("td").html()];
        $("#subbanck tr").remove();
        $.each(subBank,function(index,value){
            $("#subbanck").append("<tr><td> "+ value +" </td></tr>");
        });
        $("#subbanck tr").bind("click",function () {
            $("#subbanck tr").removeClass("bankTr");
            $(this).addClass("bankTr");
            $("#bankCardGen").click();
        });
    });

    $("#subbanck tr").bind("click",function () {
        $("#subbanck tr").removeClass("bankTr");
        $(this).addClass("bankTr");
        $("#bankCardGen").click();
    });

    $("#bankCardGen").click(function(){
       var cardInfo = bankMap[$.trim($("#subbanck .bankTr").find("td").html())];
       var cn =cardInfo.cn;
       var bin =cardInfo.bin;
       var cardNos=[];
        for (var i=0;i<10;i++)
        {
            var cardNoTmp = randomVal(bin,cn- bin.length -1);
            var sum = 0;
            for (var j=0;j<cardNoTmp.length;j++){
                if(j % 2 ==0){
                    var a = parseInt(cardNoTmp.charAt(j)) * 2;
                    if(a > 10){
                        a = 1 + a % 10;
                    }
                }else{
                    a = parseInt(cardNoTmp.charAt(j));
                }
                sum +=a;
            }
            var cardNo = cardNoTmp + '' + (10 - (sum % 10))
            cardNos.push(cardNo);
        }

        $("#cardNoList tr").remove();
        for (var i=0;i<cardNos.length;i++){
            $("#cardNoList").append("<tr><td> "+ cardNos[i] +" </td></tr>");
        }

    });

    function randomVal(str,num) {
        if(num-->0){
            var r =  Math.floor(Math.random()*10);
           return randomVal(str+r,num);
        }else{
            return str;
        }

    }
    $(function () {
        $("#bankCardGen").click();
        $("#cardNoList tr")[0].click();
    });
</script>
</body>
</html>